package creational_pattern.static_factory_pattern;

public class StaticFactoryPattern {

    public static void main(String[] args) {
        Product concreteProduct = Factory.getProduct("ConcreteProduct");
        concreteProduct.commonMethod();
        concreteProduct.diffMethod();
    }
}

abstract class Product{

    public void commonMethod(){

    }

    public abstract void diffMethod();

}

class ConcreteProduct extends Product{


    @Override
    public void diffMethod() {

    }
}
class OtherProduct extends Product{
    @Override
    public void diffMethod() {

    }
}

class Factory{
    public static Product getProduct(String type){
        if(type.equals("ConcreteProduct"))
            return new ConcreteProduct();
        else{
            return new OtherProduct();
        }

    }
}